#include <ros/ros.h>
#include <tf/transform_broadcaster.h>

int main(int argc, char** argv)
{
    ros::init(argc, argv, "robot_tf_publisher");//设置一个节点为robot_tf_publisher
    ros::NodeHandle n;
    ros::Rate r(100);
    tf::TransformBroadcaster broadcaster;//创建一个tf::TransformBroadcaster类的实例

    while(n.ok())
    {
        broadcaster.sendTransform(
                tf::StampedTransform(
                        tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.1, 0.1, 0.0)),
                        ros::Time::now(),"map", "odom_raw"));
        broadcaster.sendTransform(
                tf::StampedTransform(
                        tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.2, -0.1, 0.0)),
                        ros::Time::now(),"map", "odom"));
        broadcaster.sendTransform(
                tf::StampedTransform(
                        tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.2, 0.1, 0.0)),
                        ros::Time::now(),"odom", "base_link"));

        broadcaster.sendTransform(
                tf::StampedTransform(
                        tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.3, 0, 0.05)),
                        ros::Time::now(),"base_link", "laser"));
    }

}

